package com.ali.aliwebsite.mapper;

import com.ali.aliwebsite.entity.News;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface NewsMapper {
    @Select("select * from news")
    List<News> selectAll();

    //根据ID更新title
    @Update("UPDATE news SET title = #{title} WHERE id = #{id}")
    public int updateTitle(@Param("title") String title, @Param("id") int id);

    //根据ID更新图片外链URL
    @Update("UPDATE news SET image = #{image} WHERE id = #{id}")
    public int updateImage(@Param("image") String image, @Param("id") int id);
}
